﻿using TransControlSystem.Dao;
using TransControlSystem.Model;

namespace TransControlSystem.ViewModel.Common
{
    /// <summary>
    /// PLC帮助类
    /// </summary>
    public class PlcHelper
    {
        /// <summary>
        /// 从数据库获取PLC地址
        /// </summary>
        /// <returns></returns>
        public static string GetPlcAddress()
        {
            PlcAddress plcAddress = new PlcAddress();
            plcAddress.Id = 1;
            PlcAddress address = DapperTools.Query<PlcAddress>("select * from ProgrammableLogicControllerConfig where Id = @Id", plcAddress);
            if (address != null)
            {
                return address.SiemensPlcAddress;
            }
            else
            {
                return "";
            }
        }
    }
}
